package com.yt.controller;

import com.yt.entity.CommonResult;
import com.yt.entity.Novel;
import com.yt.mapper.NovelMapper;
import com.yt.service.NovelService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class NovelController {
    @Resource
    NovelService novelService;
    @Value("${server.port}")
    String port;

    @GetMapping("/novel/{aid}")
    public CommonResult<List<Novel>> getNovelsByAid(@PathVariable("aid")Integer aid){
        CommonResult<List<Novel>> result=new CommonResult<>();
        result.setCode(200);
        result.setInfo("根据作者ID返回小说内容,from :"+port);
        result.setT(novelService.getNovelsByAid(aid));
        return result;
    }

}
